package com.paradogs.framework.server;

import com.paradogs.framework.core.msg.ByteData;
import com.paradogs.framework.core.netty.server.ServerProperties;
import com.paradogs.framework.core.queue.AbstractMsgConsumer;
import com.paradogs.framework.core.utils.MsgUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.lang.reflect.InvocationTargetException;

/**
 * @author: yumi
 * @date: 2023/11/13  10:30
 * @Description: TODO
 */
@Slf4j
@Scope("prototype")
@Primary
@Component
@ConditionalOnMissingBean(ServerMsgConsumer.class)
public class ServerMsgConsumer extends AbstractMsgConsumer {


    @Autowired
    private ServerProperties serverProperties;

    @Override
    public void handle(ByteData byteData) throws InvocationTargetException, IllegalAccessException {

        /**
         * 找到对应的 Controller 处理
         */
        MsgUtils.adapterHandle(byteData);
    }
}
